package ru.ncedu.java.dmsi.robots.model;

import ru.ncedu.java.dmsi.robots.actions.Action;
import ru.ncedu.java.dmsi.robots.strategies.RobotStrategy;

public class Robot extends ActiveWorldObject {
    private int id;
    private Point location;
    private RobotStrategy strategy;

    public Robot( Point loc, RobotStrategy moveStrategy ) {
        location = loc;
        strategy = moveStrategy;
        id = generateID();
    }

    public void ChangeStrategy( RobotStrategy newStrategy ) {
        strategy = newStrategy;
    }
    public Point getPoint() {
        return location;
    }
    public int getId() {
        return id;
    }
    public Action doStep( ActionContext context ) {
        return strategy.getAction(context);
    }
    public void move( Point newLocation ) {
        location = newLocation;
    }
    @Override
    public String toString() {
        return Integer.valueOf(id).toString();
    }
}
